<?php
namespace Admin\Controller;

use Admin\Controller\CommonController;

class RecordController extends CommonController
{
    public function index()
    {
        $this->display();
    }

    public function msgList(){
        $search = $_POST['search'];
        if(!empty($search)){
            $where['s.username|g.game|c.currency'] = array(
                'like',
                '%'.$search.'%'
            );
        }
        $data['rows'] = M('RechargeRecord')->alias('a')
            ->where($where)
            ->join('left join '.C('DB_PREFIX').'currency c on a.currencyid=c.curyid')
            ->join('left join '.C('DB_PREFIX').'game g on c.gameid=g.gameid')
            ->join('left join '.C('DB_PREFIX').'user s on a.uid=s.uid')

            ->page($_POST['page'],$_POST['rows'])
            ->field('a.rechargeid,a.cnum,a.balance,a.unum,a.status,a.createtime,c.currency,g.game,s.username')
            ->order('a.createtime desc')
            ->select();

        $data['total'] = M('recharge_record')->count();
        $this->ajaxReturn($data);
    }

    /**
     * 删除信息
     */

   /* public function delMsg(){
        $where['rechargeid']=array('in',$_POST['id']);
        $option = M('recharge_record')
            ->where($where)
            ->save(['status'=>0]);
        if($option){
            $data = [
                'status' => 1,
                'msg' => '数据删除成功'
            ];
        }else{
            $data = [
                'status' => 0,
                'msg' => '数据删除失败'
            ];
        }
        $this->ajaxReturn($data);
    }*/

}

